package com.example.smartcity.Service.Impl;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;

@Configuration
public class MailConfig {

    @Bean
    public JavaMailSender javaMailSender() {
        JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
        mailSender.setHost("smtp.example.com");
        mailSender.setPort(587);

        // 如果需要身份验证，取消下面两行的注释并设置正确的用户名和密码
        // mailSender.setUsername("your_username");
        // mailSender.setPassword("your_password");

        return mailSender;
    }
}